<!-- 企业信息 -->
<template>
    <div>
       <el-breadcrumb separator-class="el-icon-arrow-right" style="margin-bottom: 20px">
            <el-breadcrumb-item :to="{ path: '/backstage/index' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>企业信息(展示)</el-breadcrumb-item>
        </el-breadcrumb>
        <el-card shadow="hover">
            <el-descriptions title="企业信息" direction="vertical">
                <template slot="extra">
                    <el-button type="primary" size="small" @click="toPersonalEditPageFunc">修改</el-button>
                </template>
                <el-descriptions-item label="企业头像">
                    <el-avatar shape="square" :size="80" fit="fill" :src="avatar"></el-avatar>
                </el-descriptions-item>
                <el-descriptions-item label="企业背景图">
                    <el-avatar shape="square" :size="80" fit="cover" :src="bgImage"></el-avatar>
                </el-descriptions-item>
                <el-descriptions-item label="企业名称">
                    <el-tag size="small">{{name}}</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="企业账号">{{account}}</el-descriptions-item>
                <el-descriptions-item label="后台登陆密码">
                    <el-tag type="success" size="small">{{password}}</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="联系人">
                    <el-tag type="info" size="small">{{leader ? leader : '未知'}}</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="联系电话">{{phone}}</el-descriptions-item>
                <el-descriptions-item label="企业邮箱">{{email}}</el-descriptions-item>
                <el-descriptions-item label="注册时间">
                    <el-tag type="success" size="small">{{createTime}}</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="企业地址">{{address}}</el-descriptions-item>
                <el-descriptions-item label="企业简介">&emsp;&emsp;{{introduction}}</el-descriptions-item>
            </el-descriptions>
        </el-card> 
    </div>
    
</template>

<script>
import { getStore } from '../../../storage/storage';
import { getLoginCompanyInfo } from '../../../api/enterpriseManage/index'
export default {
  data () {
    return {
        name: '',
        account: getStore("account"),
        password: getStore("password"),
        leader: '',
        phone: '',
        email: '',
        createTime: '',
        address: '',
        bgImage: '',
        avatar: '',
        introduction: '',
    }
  },
  methods:{
    // 去修改页面
    toPersonalEditPageFunc(){
      this.$router.push("/backstage/personal/editCompanyInfo");
    }
  },
  created(){
    this.password = getStore("password").substring(0,1) + '****' + getStore("password").substr(5);
    // 企业中心 获取该企业的信息
    const params = {
        account: this.account,
    }
    getLoginCompanyInfo(params).then(res=>{
        console.log(res.data.data);
        this.introduction = res.data.data.introduction ? res.data.data.introduction : '无';
        this.bgImage = res.data.data.bgImage;
        this.avatar = res.data.data.avatar;
        this.name = res.data.data.name;
        this.leader = res.data.data.leader;
        this.phone = res.data.data.phone;
        this.email = res.data.data.email;
        this.createTime = res.data.data.createTime;
        this.address = res.data.data.address;
    })
  }
}
</script>

<style scoped>

</style>
